[MOB-12262] add enableembeddedmessaging property to IterableConfig#743
[MOB-12262] add enableembeddedmessaging property to IterableConfig#743
Conversation
…le from RNIterableAPI.mm
…or new architecture
… consistent formatting
…7-add-new-architecture-support
…IterableAPI module
…unnecessary logging
…acy architectures
…ft to streamline code
…ew-arch/MOB-11828-add-backwards-compatibility
…new-arch/MOB-11833-format-files
…7-add-new-architecture-support
…ew-arch/MOB-11828-add-backwards-compatibility
…eAPI in package.json
…d-api-and-codegen [MOB-11826] make-frontend-api-and-codegen
[MOB-11833] format-files
…ew-arch/MOB-11828-add-backwards-compatibility
…ft and iOS SDK dependency
…ew-arch/MOB-11828-add-backwards-compatibility
…s-compatibility [MOB-11828] add-backwards-compatibility
Added copilot suggestion Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…t suggestion Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…t suggestion Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…itecture-support [MOB-11827] add-new-architecture-support
…gger functionality
…' into jwt/MOB-12298-new-improve-logger
…-out IterableLogger calls
…etrypolicy-ts-classes
…sses' into jwt/MOB-10947-task-3-android-retrypolicy-config-at-android-br
…oid-br' into jwt/MOB-11032-task-4-ios-bridge-retrypolicy-and-authfailure
…lure' into jwt/MOB-12231-create-an-iterableapi-class-for-api-calls
…' into jwt/MOB-12298-new-improve-logger
…' into jwt/MOB-12298-new-improve-logger
…OB-12260-create-embedded-tab-in-example-app
…-app' into loren/embedded/MOB-12261-add-embedded-manager-class
|
Diff Coverage: The code coverage on the diff in this pull request is 79.5%. Total Coverage: This PR will increase coverage by 4.28%. File Coverage Changes
🛟 Help
This is from Qlty Cloud, the successor to Code Climate Quality. Learn more. |
21 new issues
This is from Qlty Cloud, the successor to Code Climate Quality. Learn more. |
| public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { | ||
| IterableLogger.d(TAG, "initializeWithApiKey: " + apiKey); | ||
| IterableConfig.Builder configBuilder = Serialization.getConfigFromReadableMap(configReadableMap); | ||
|
|
||
| @Override | ||
| public String getName() { | ||
| return "RNIterableAPI"; | ||
| if (configReadableMap.hasKey("urlHandlerPresent") && configReadableMap.getBoolean("urlHandlerPresent") == true) { | ||
| configBuilder.setUrlHandler(this); | ||
| } | ||
|
|
||
| if (configReadableMap.hasKey("customActionHandlerPresent") && configReadableMap.getBoolean("customActionHandlerPresent") == true) { | ||
| configBuilder.setCustomActionHandler(this); | ||
| } | ||
|
|
||
| if (configReadableMap.hasKey("inAppHandlerPresent") && configReadableMap.getBoolean("inAppHandlerPresent") == true) { | ||
| configBuilder.setInAppHandler(this); | ||
| } | ||
|
|
||
| if (configReadableMap.hasKey("authHandlerPresent") && configReadableMap.getBoolean("authHandlerPresent") == true) { | ||
| configBuilder.setAuthHandler(this); | ||
| } | ||
|
|
||
| IterableApi.initialize(reactContext, apiKey, configBuilder.build()); | ||
| IterableApi.getInstance().setDeviceAttribute("reactNativeSDKVersion", version); | ||
|
|
||
| IterableApi.getInstance().getInAppManager().addListener(this); | ||
|
|
||
| // MOB-10421: Figure out what the error cases are and handle them appropriately | ||
| // This is just here to match the TS types and let the JS thread know when we are done initializing | ||
| promise.resolve(true); |
| @ReactMethod | ||
| public void trackPushOpenWithCampaignId(Integer campaignId, Integer templateId, String messageId, Boolean appAlreadyRunning, ReadableMap dataFields) { | ||
| RNIterableInternal.trackPushOpenWithCampaignId(campaignId, templateId, messageId, optSerializedDataFields(dataFields)); | ||
| public void trackPushOpenWithCampaignId(double campaignId, @Nullable Double templateId, String messageId, boolean appAlreadyRunning, @Nullable ReadableMap dataFields) { |
|
|
||
| @ReactMethod | ||
| public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, Integer campaignId, Integer templateId) { | ||
| public void updateSubscriptions(@Nullable ReadableArray emailListIds, @Nullable ReadableArray unsubscribedChannelIds, @Nullable ReadableArray unsubscribedMessageTypeIds, @Nullable ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { |
|
|
||
| @ReactMethod | ||
| public void trackInAppClose(String messageId, Integer location, Integer source, @Nullable String clickedUrl) { | ||
| public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) { |
| } | ||
|
|
||
| @Override | ||
| public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
| } | ||
|
|
||
| @ReactMethod | ||
| public void updateSubscriptions(@Nullable ReadableArray emailListIds, @Nullable ReadableArray unsubscribedChannelIds, @Nullable ReadableArray unsubscribedMessageTypeIds, @Nullable ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { |
| } | ||
|
|
||
| @ReactMethod | ||
| public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) { |
| private func setupUserNotificationCenter() { | ||
| UNUserNotificationCenter.current().delegate = self | ||
| UNUserNotificationCenter.current().getNotificationSettings { settings in | ||
| if settings.authorizationStatus != .authorized { | ||
| ITBInfo("Not authorized") | ||
| // not authorized, ask for permission | ||
| UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, _ in | ||
| ITBInfo("auth: \(success)") | ||
| if success { | ||
| DispatchQueue.main.async { | ||
| UIApplication.shared.registerForRemoteNotifications() | ||
| } | ||
| } | ||
| // TODO: Handle error etc. | ||
| } | ||
| } else { | ||
| // already authorized | ||
| ITBInfo("Already authorized") | ||
| DispatchQueue.main.async { | ||
| UIApplication.shared.registerForRemoteNotifications() | ||
| } | ||
| } | ||
| } |
| const requestNotificationPermission = async () => { | ||
| if (Platform.OS === 'android') { | ||
| const apiLevel = Platform.Version; // Get the Android API level | ||
|
|
||
| if (apiLevel >= 33) { | ||
| // Check if Android 13 or higher | ||
| try { | ||
| const granted = await PermissionsAndroid.request( | ||
| PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS, | ||
| { | ||
| title: 'Notification Permission', | ||
| message: | ||
| 'This app needs access to your notifications for push, in-app messages, embedded messages and more.', | ||
| buttonNeutral: 'Ask Me Later', | ||
| buttonNegative: 'Cancel', | ||
| buttonPositive: 'OK', | ||
| } | ||
| ); | ||
| if (granted === PermissionsAndroid.RESULTS.GRANTED) { | ||
| console.log('Notification permission granted'); | ||
| } else { | ||
| console.log('Notification permission denied'); | ||
| } | ||
| } catch (err) { | ||
| console.warn(err); | ||
| } | ||
| } else { | ||
| // For Android versions below 13, notification permission is generally not required | ||
| // or is automatically granted upon app installation. | ||
| console.log( | ||
| 'Notification permission not required for this Android version.' | ||
| ); | ||
| } | ||
| } |
| static updateSubscriptions( | ||
| emailListIds: number[] | undefined, | ||
| unsubscribedChannelIds: number[] | undefined, | ||
| unsubscribedMessageTypeIds: number[] | undefined, | ||
| subscribedMessageTypeIds: number[] | undefined, | ||
| emailListIds: number[] | null, | ||
| unsubscribedChannelIds: number[] | null, | ||
| unsubscribedMessageTypeIds: number[] | null, | ||
| subscribedMessageTypeIds: number[] | null, | ||
| campaignId: number, | ||
| templateId: number |
🔹 JIRA Ticket(s) if any
✏️ Description
Adds the property to the config file